package com.acarter.scenemonitor.propertydescriptor.enums;
/**
 * <p>Title</p>
 * 
 * <p>Description: </p>
 *
 * <p>Copyright (c) 2007</p>
 *
 * @author Andrew Carter
 * @version 
 */


/**
 * Enumerates the permissible texture apply modes.
 * 
 * @author Andrew Carter
 */
public enum E_TextureApplyMode {
	
  /** Apply modifier that replaces the previous pixel color with the texture color. */
  AM_REPLACE ("AM_REPLACE", 0),

  /** Apply modifier that replaces the color values of the pixel but makes use of the alpha values. */
  AM_DECAL ("AM_DECAL", 1),

  /** Apply modifier multiples the color of the pixel with the texture color. */
  AM_MODULATE ("AM_MODULATE", 2),

  /** Apply modifier that combines the color of the pixel with the texture
   * color, such that the final color value is Cv = (1 - Ct) Cf. Where
   * Ct is the color of the texture and Cf is the initial pixel color. */
  AM_BLEND ("AM_BLEND", 3),

  /** Apply modifier combines two textures. */
  AM_COMBINE ("AM_COMBINE", 4),

  /** Apply modifier adds two textures. */
  AM_ADD ("AM_ADD", 5);
	
	/** String representation of the enum value */
	private String name;

	/** Integer value of the enum value */
	private int value;

	/**
	 * Private constructor.
	 * 
	 * @param value
	 *            String literal of the enum
	 */
	private E_TextureApplyMode(String name, int value) {

		this.name = name;
		this.value = value;
	}

	/**
	 * Returns the enum constant matching the name string.
	 * 
	 * @param name
	 *            string value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_TextureApplyMode getConstant(String name) {

		for (E_TextureApplyMode constant : E_TextureApplyMode.values()) {

			if (constant.toString().compareToIgnoreCase(name) == 0)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the enum constant matching the type value.
	 * 
	 * @param type
	 *            type value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_TextureApplyMode getConstant(int type) {

		for (E_TextureApplyMode constant : E_TextureApplyMode.values()) {

			if (constant.getType() == type)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the string value of the constant.
	 */
	public String toString() {

		return name;
	}
	
	/**
	 * Returns the integer value of the constant.
	 * @return 
	 */
	public int getType() {
		
		return value;
	}
}
